package com.sky.controller.admin;

import com.sky.result.Result;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import java.security.Key;

@RestController("adminShopController")
@RequestMapping("/admin/shop")
@Slf4j
@Api(tags = "店铺状态")
public class ShopController {
    public static final String key = "SHOP_STATUS";

    @Autowired
    private RedisTemplate redisTemplate;

    @GetMapping("/status")
    public Result<Object> findMerchantStatus(){
        Object status = redisTemplate.opsForValue().get(key);
        log.warn("{}"+status);
        return Result.success(status);
    }

    @PutMapping("/{status}")
    public Result updateMerchantStatus(@PathVariable Integer status){
        redisTemplate.opsForValue().set(key,status);
        return Result.success();
    }
}
